home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14125 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.3 KB

  1. Path: news.corp.sgi.com!user
  2. From: sandvik@sgi.com (Kent Sandvik)
  3. Newsgroups: comp.lang.smalltalk,comp.object,comp.lang.c++,comp.lang.java
  4. Subject: Re: The Good, the Bad, the Ugly, and the Wicked ...
  5. Date: Thu, 28 Mar 1996 10:28:51 -0800
  6. Organization: Silicon Graphics, Inc.
  7. Message-ID: <AD801A639668229B48@mac-sandvik.engr.sgi.com>
  8. References: <31570B8E.5A12@vmark.com> <31586721.1750@mobius.net> <4jbk0m$jt9@news4.digex.net> <AD7EDB45966858C12@mac-sandvik.engr.sgi.com> <4jecok$a01@news4.digex.net>
  9. NNTP-Posting-Host: mac-sandvik.engr.sgi.com
  10.  
  11. In article <4jecok$a01@news4.digex.net>,
  12. ell@access2.digex.net (Ell) wrote:
  13.  
  14.   >Kent Sandvik (sandvik@sgi.com) wrote:
  15.   >:   >C++ very much has dynamic binding; lookup virtual functions.
  16.   > 
  17.   >: It depends how you defined dynamic binding, could you send messages to
  18.   >: arbitrary methods in C++ during runtime (or java, by the way)?
  19.   >
  20.   >In C++ the specific function being invoked is determined by the specific
  21.  
  22.   >object assigned to a pointer at any one time.  The pointer has a static 
  23.   >type, yet it can invoke functions of other types during run-time.
  24.  
  25. Yes, but I was hinting at the SmallTalk/Objective-C et rest feature of
  26. calling methods, and if this method is not found, the system responds
  27. anyway. The static language approach is to let the compiler flag such
  28. cases, while in fully dynamic languages anything could be called, whether
  29. it's defined or not. The first
  30. approach is oh so useful with very flexible and ever changing user
  31. interface
  32. frameworks, for example.
  33.  
  34. The vtable approach works in the context of staticly defining the possible
  35. outcomes. It has drawbacks as well, like the dreadful 'fragile base class'
  36. problem that haunts most systems where someone wants to ship the base class
  37. in a dynamic shared library, for example. Someone subclasses it, and if now
  38. the vendor ships an alternate version, the vtable offsets differ, so that
  39. the sub-classed system won't work any longer.
  40.  
  41. Not to speak of the headaches creating ROM-only code using vtables.
  42.  
  43. Cheers, Kent
  44.  
  45.  
  46.  
  47.  
  48.           Kent Sandvik, Silicon Graphics, Inc.    Member of Technical Staff
  49.                              Email: sandvik@sgi.com  Phone: +1 415 933-6417
  50.                     http://reality.sgi.com/sandvik/  (sgi http:/kent.engr/)
  51.                                              "May all developers be happy."
  52.